define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'system.user/index',
        add_url: 'system.user/add',
        edit_url: 'system.user/edit',
        delete_url: 'system.user/delete',
        modify_url: 'system.user/modify',
        export_url: 'system.user/export',
        import_url: 'system.user/import',
    };

    var Controller = {

        index: function () {

            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [{
                        text: '添加',
                        url: init.add_url,
                        method: 'open',
                        auth: 'add',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus',
                        extend: 'data-full="true"',
                    }],
                    'delete'
                    // ,'export',
                    // [{
                    //     text: '导入',
                    //     url: init.import_url,
                    //     method: 'open',
                    //     auth: 'import',
                    //     class: 'layui-btn layui-btn-success layui-btn-sm',
                    //     icon: 'fa fa-plus',
                    //     extend: '',
                    // }]
                ],
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 80, title: '用户id'},
                    {field: 'avatar', minWidth: 80, search: false, templet: ea.table.image, title: '用户头像'},
                    {field: 'user_name', minWidth: 80, title: '用户名称'},
                    {field: 'sex', minWidth: 80, title: '性别',search: 'select', selectList: {'男': '男', '女': '女'}},
                    {field: 'age', minWidth: 80, title: '年龄'},
                    {field: 'party_date', minWidth: 80, title: '入党时间'},
                    {field: 'district', minWidth: 80, title: '区县'},
                    {field: 'town', minWidth: 80, title: '乡镇'},
                    {field: 'community', minWidth: 80, title: '社区'},
                    {field: 'party', minWidth: 80, title: '党组织'},
                    {field: 'wechart', minWidth: 80, title: '微信号'},
                    {field: 'specialty', minWidth: 80, title: '特长'},
                    {field: 'claim', minWidth: 80, title: '认领岗位'},
                    {field: 'free_time', minWidth: 80, title: '空闲时间'},
                    {field: 'identify', minWidth: 80, title: '身份证号'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            'edit',
                            'delete'
                        ]
                    }
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        import: function() {
            ea.listen();
        }
    };
    return Controller;
});